<template>
  <div>
    <el-table :data="dataList" border>
        <el-table-column label="id" prop="id"></el-table-column> 
        <el-table-column label="处理类型" prop="type_txt"></el-table-column>
        <el-table-column label="处理内容" prop="txt"></el-table-column>
        <el-table-column label="处理人">
          <template slot-scope="scope">
            <span v-if="scope.row.agent_id > 0">后台</span>
            <span v-else>{{scope.row.user.username}}</span>
          </template>
        </el-table-column>
        <el-table-column label="处理时间" prop="createtime">
        </el-table-column>
    </el-table>
    <el-pagination :total="total" :current-page="query.page" :page-size="query.pageSize" @current-change="changePage"></el-pagination>
  </div>
</template>

<script>
import {processList} from "@/api/smog/index.js"
  export default {
    props:[
      'row'
    ],
    watch:{
      row:{
        handler:function(val){
          if(val && val.id){
            this.query.device_id = val.id;
            this.getData()
          }
        },
        immediate:true,
      }
    },
    data(){
      return {
        query:{
          page:1,
          pageSize:10,
          device_id:''
        },
        total:0,
        dataList:[],        
      }
    },
    methods:{
      getData(){
        processList(this.query).then(res=>{
          this.dataList = res.data.data.data;
          this.total = res.data.data.total;
        })
      },
      changePage(page){
        this.query.page = page;
        this.getData()
      }
    }
  }
</script>

<style scoped>

</style>
